# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

  def community_nodes_select
    community_nodes = Node.find(:all,
                  :conditions => ["community_id = ?",
                  session[:community_id]],
                  :order => "name")
    blank_node = Node.new()
    blank_node_array = Array.new()
    blank_node_array.push(blank_node)
    blank_node_array + community_nodes
  end

  def community_nodes_with_lat_long_select
    community_nodes = Node.find(:all,
                  :conditions => ["community_id = ? and lat != ''",
                  session[:community_id]],
                  :order => "name")
    blank_node = Node.new()
    blank_node_array = Array.new()
    blank_node_array.push(blank_node)
    blank_node_array + community_nodes
  end

  def community_group_category_select
    community_group_categories = Group.find(:all,
                                            :conditions => ['community_id = ?', session[:community_id]],
                                            :order => 'name')
    blank_group = Group.new()
    group_array = Array.new()
    group_array.push(blank_group)
    group_array + community_group_categories
#    group_array << blank_group << community_group_categories
  end
end
